package day05.homework;
//利用for循环计算：求数字1到100之内，所有偶数的和，并输出
public class Answer1 {
    public static void main(String[] args) {
        int start=1,end=100;
        int sum=getSum(start,end);
        System.out.println(sum);
    }

    private static int getSum(int start, int end) {
        int sum=0;
        for (int i = start; i <end ; i++) {
            if (i%2==0){
                sum+=i;
            }
        }
        return sum;
    }
}
